<template>
	<view class="page_box">
		<view class="head_box " v-if="0">
			<yy-custom bgColor="bg-gradual-blue">
				<block slot="backText">返回</block>
				<block slot="content">导航栏</block>
			</yy-custom>
		</view>

		<view class="content_box   ">
			<view class="head padding-lr bg-white flex align-center justify-between text-black margin-bottom">
				<text class="f28">
					总人数：
					<text>{{myRecordTotal}}</text>
				</text>
			</view>
			<scroll-view scroll-y="true" class="scroll" @scrolltolower="lower" enable-flex="true">
				<view @click="gotoMyRecordPage(item.id)" class="info padding flex margin-bottom" v-for="(item, index) in myRecord" :key="index">
					<image
						:src="item.headimgurl"
						mode=""
						style="width: 120rpx ; height: 120rpx;"
						class="round bg-gradual-green"
					></image>
					<view class="flex flex-direction margin-left justify-around">
						<view class="flex align-center  ">
							<text class="f30 text-light">{{item.nickname ? item.nickname : "匿名用户"}}</text>
							<view class="gg flex align-center justify-center margin-left">
								<text class="cuIcon-favorfill margin-right-xs" style="color: #fbb03b;"></text>
								<text class="f26 text-white">{{item.level}}</text>
							</view>
						</view>
						<text class="f24 text-gray">{{ item.createDt }}</text>
					</view>
				</view>
			</scroll-view>
		</view>
		<view class="foot_box"></view>
		<!-- 登录提示 -->
		<yy-login v-if="false"></yy-login>
		<!-- 加载提示 -->
		<yy-loading text="加载中.." mask="true" click="true" ref="loading"></yy-loading>
		<!-- 信息提示-->
		<u-toast ref="uToast" />
	</view>
</template>

<script>
export default {
	components: {},
	data() {
		return {
			show: false,
			userid:"",
			page:1,
			/**
			 *用户的下级
			 */
			myRecord: [],
			myRecordTotal:'',
		};
	},
	onShow() {},
	onLoad(option) {
		this.userid = option.userid;
		this.getRecords(0);
	},
	methods: {
		async getRecords(style) {
			
			if(style == 0){
				this.page = 1;
			}else{
				this.page += 1;
			}
			
			let res = await this.$u.get('inviterrecord/page?superId=' + this.userid + "&current=" + this.page);
			if (res.code == 1) {
				return false;
			}
			this.myRecordTotal = res.data.team.total;
			if(style == 0){
				this.myRecord = res.data.team.records;
			}else{
				this.myRecord = this.myRecord.concat(res.data.team.records);
			}
		},
		jump(url) {
			console.log('url: ', url);
			uni.navigateTo({
				url
			});
		},
		click(index) {
			console.log(`点击了第${index + 1}项，内容为：${this.list[index].text}`);
		},
		gotoMyRecordPage(id){
			console.log(id);
			uni.navigateTo({
				url:"/pages/myTeam/myRecordPage?userid=" + id
			});
		},
		lower(){
			this.getRecords(1);
			console.log("翻页");
		}
	}
};
</script>

<style lang="scss" scoped>
.page_box {
	background-color: #f7f7f7;
	.scroll {
		height: calc(100vh - 200rpx);
	}
	.content_box {
		.head {
			width: 100vw;
			height: 100rpx;
		}
		.info {
			width: 750rpx;
			height: 180rpx;
			background: #ffffff;
			.gg {
				width: 80rpx;
				height: 30rpx;
				background: linear-gradient(139deg, #393b56, #4f4f62);
				border-radius: 10rpx;
			}
		}
	}
}
</style>
